Interactive Web-Based Data Visualization with R, Plotly, and Shiny by Sievert Carson;

Interactive Web-Based Data Visualization with R, Plotly, and Shiny by Sievert Carson;

Author:Sievert, Carson;
Language: eng
Format: epub
Publisher: CRC Press LLC
Published: 2020-05-15T00:00:00+00:00


FIGURE 16.19: Engine displacement versus highway miles per gallon by class of car. The linear model for each class, as well as the individual observations, can be selected by hovering over the line of fitted values. An individual observation can also be selected by hovering over the relevant point. For a video demonstration of the interactive, see https://bit.ly/smooth-highlight. For the interactive, see https://plotly-r.com/interactives/smooth-highlight.html

Figure 16.19 demonstrates highlighting in a single view when the querying variable is the row index, but the linking could also be done by matching the querying variable with the ggplot2 group of interest, as is done in Figure 16.20. This way, when a user highlights an individual point, the entire group is highlighted (instead of just that one point).

m <- highlight_key(mpg, ~class)

p1 <- ggplot(m, aes(displ, fill = class)) + geom_density()

p2 <- ggplot(m, aes(displ, hwy, fill = class)) + geom_point()

subplot(p1, p2) %>% hide_legend() %>% highlight("plotly_hover")



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.